// 导入路由组件，配置路由规则，初始化路由，导出路由实例。

// 1. 导入插件
import VueRouter from 'vue-router'
// 2.  注册路由
import Vue from 'vue'
Vue.use(VueRouter)
// 3. 导入路由组件
import HeroesList from './views/HeroesList.vue'
import HeroesAdd from './views/HeroesAdd.vue'
import HeroesEdit from './views/HeroesEdit.vue'
import ZbList from './views/ZbList.vue'
import JnList from './views/JnList.vue'
// 4. 配置路由规则
const routes = [
  { path: '/', redirect: '/heroes' },
  { path: '/heroes', component: HeroesList },
  { path: '/heroes/add', component: HeroesAdd },
  // 编辑
  { path: '/heroes/edit/:id', component: HeroesEdit },
  { path: '/zb', component: ZbList },
  { path: '/jn', component: JnList }
]
// 5. 初始化路由
const router = new VueRouter({ routes , linkExactActiveClass: 'active'})
// 6. 导出路由实例
export default router
